package gecko.view.swing.GESTION;

import java.awt.BorderLayout;
import java.awt.FlowLayout;

import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;

import gecko.control.CtrlGecko;
import gecko.view.IObservable;
import gecko.view.swing.VAdmin;

public class VGestion extends VAdmin implements IObservable {
	
    private static final long serialVersionUID = 1L;
	
	public VGestion(CtrlGecko controleur) {
		super(controleur, false);
   
		// Creation des composants
		JLabel lGestion = new JLabel(new ImageIcon("images/menu/Titre/GestionT_V.png"));
			        
		// Creation du conteneur << Libell� >> et ajout des composants
		JPanel pLib = new JPanel(new FlowLayout());
		pLib.add(lGestion);
		pLib.setBorder(BorderFactory.createEmptyBorder(50, 0, 0, 0));
				
		JPanel pCenter = new JPanel(new FlowLayout());
		pCenter.setOpaque(false);
		
		JButton bAjout = new JButton(new ImageIcon("images/logotype/bleu/Ajout_BeT.png"));
		bAjout.setActionCommand("AJOUT_CONTRAT");
		bAjout.addActionListener(controleur);
		bAjout.setToolTipText("");
		bAjout.setBorder(null);
		bAjout.setBorderPainted(false);
		bAjout.setContentAreaFilled(false);
		bAjout.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 20));

		JButton bModification = new JButton(new ImageIcon("images/logotype/bleu/Modification_BeT.png"));
		bModification.setActionCommand("MODIFICATION_CONTRAT");
		bModification.addActionListener(controleur);
		bModification.setBorder(null);
		bModification.setBorderPainted(false);
		bModification.setContentAreaFilled(false);	
		bModification.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 20));
		
		JButton bArchive = new JButton(new ImageIcon("images/logotype/bleu/Consultation_BeT.png"));
		bArchive.setActionCommand("ARCHIVE");
		bArchive.addActionListener(controleur);
		bArchive.setBorder(null);
		bArchive.setBorderPainted(false);
		bArchive.setContentAreaFilled(false);	
		bArchive.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 20));
		
		pCenter.add(bAjout);
		pCenter.add(bModification);
		pCenter.add(bArchive);
		
		pCenter.setBorder(BorderFactory.createEmptyBorder(150, 0, 0, 0));
		
		// Ajout de ce conteneur au conteneur de ma fenetre
		lCorps.add(pLib, BorderLayout.NORTH);
		lCorps.add(pCenter, BorderLayout.CENTER);
				
	    // Assemblage de la fenetre
	    this.pack();

	    // Affichage de cette fenetre
	    this.place();

	}
}